<template>
  <div class="home">
    <img
      alt="Vue logo"
      src="../assets/logo.png"
    >
    <h1 @click="$router.push('/about?a=123&b=大餐')">query</h1>
    <h1 @click="goAboutWithParams">params</h1>
  </div>
</template>

<script>
// @ is an alias to /src

export default {
  name: "Home",
  components: {},
  created() {
    console.log("home created");
  },
  methods: {
    goAboutWithParams() {
      this.$router.push({
        // 必须是name的方式来传递 否则失效
        name: "About",
        params: {
          username: "pp",
          age: 18,
        },
      });
    },
  },
};
</script>
